{extend name='admin@public/content'}

{block name="button"}
{if auth("$classuri/add")}
<button data-open="{:url('add')}" class='layui-btn layui-btn-sm'>添加</button>
{/if}
{if auth("$classuri/forbid")}
<button data-update data-field='status' data-value='2' data-action='{:url("$classuri/forbid")}' class='layui-btn layui-btn-sm layui-btn-warm'>禁用</button>
{/if}
{if auth("$classuri/resume")}
<button data-update data-field='status' data-value='1' data-action='{:url("$classuri/resume")}' class='layui-btn layui-btn-sm layui-btn-normal'>启用</button>
{/if}
{if auth("$classuri/del")}
<button data-update data-field='delete' data-action='{:url("$classuri/del")}' class='layui-btn layui-btn-sm layui-btn-danger'>删除</button>
{/if}
{/block}

{block name="content"}
<form class="layui-form layui-form-pane form-search" action="{:request()->url()}" onsubmit="return false" method="get">
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">栏目</label>
        <div class="layui-input-inline">
            <select name="pid" lay-search>
                <option {if empty($Think.get.pid)}selected="selected"{/if} value="">所有</option>
                {foreach $cate as $v}
                <option {if $Think.get.pid==$v.id}selected="selected"{/if} value="{$v.id}">{$v.title}</option>
                {/foreach}
            </select>
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">专家名称</label>
        <div class="layui-input-inline">
            <input name="name" value="{$Think.get.name|default=''}" placeholder="请输入专家名称" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">时间</label>
        <div class="layui-input-inline">
            <input name="create_at" id="range-date" value="{$Think.get.create_at}" placeholder="请选择时间" class="layui-input" autocomplete="off">
        </div>
    </div>

    <div class="layui-form-item layui-inline">
        <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i> 搜 索</button>
    </div>

</form>
<script>
    window.laydate.render({range: true, elem: '#range-date'});
    window.form.render();
</script>
<!-- 表单搜索 结束 -->

<form onsubmit="return false;" data-auto="true" method="post">
    {empty name='list'}
    <p class="help-block text-center well">没 有 记 录 哦！</p>
    {else}
    <input type="hidden" value="resort" name="action">
    <table class="layui-table" lay-skin="line">
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox'>
                <input data-auto-none="" data-check-target='.list-check-box' type='checkbox'>
            </th>
            <th class='list-table-sort-td'>
                <button type="submit" class="layui-btn layui-btn-normal layui-btn-xs">排 序</button>
            </th>
            <th class='text-left nowrap'>头像照片</th>
            <th class='text-left nowrap'>专家姓名</th>
            <th class='text-left nowrap'>身份简介</th>
            <th class='text-left nowrap'>所属分栏</th>
            <th class='text-left nowrap'>添加时间</th>
            <th class='text-left nowrap'>是否可用</th>
            <th class='text-left nowrap'>操作</th>
        </tr>
        </thead>
        <tbody>
        {foreach $list as $key=>$vo}
            <tr>
                <td class='list-table-check-td think-checkbox'>
                    <input class="list-check-box" value='{$vo.id}' type='checkbox'>
                </td>
                <td class='list-table-sort-td'>
                    <input name="_{$vo.id}" value="{$vo.sort}" class="list-sort-input">
                </td>
                <td class='text-left nowrap'>
                    <img src="{$vo.thumb}" width="60px" height="60px" data-tips-image alt="">
                </td>
                <td class='text-left nowrap'>
                    <span style="font-weight: bold">{$vo.name}</span>
                </td>
                <td class='text-left nowrap'>
                    <span data-tips-text="{$vo.desc}" style="font-weight: bold">{$vo.desc|raw|jiequ=40}</span>
                </td>
                <td class='text-left nowrap'>
                    {$vo.pid}
                </td>
                <td class='text-left nowrap'>
                    {$vo.create_at|format_datetime|str_replace=' ','<br>',###|raw}
                </td>
                <td class='text-left nowrap'>
                    {if $vo.status == 1}
                    <font color="green">正常使用</font>
                    {else}
                    <font color="red">已禁用</font>
                    {/if}
                </td>
                <td class='text-left nowrap'>
                    <!-- Single button -->
                    <div class="btn-group">
                        {if auth("$classuri/add")}
                        <button type="button" class="btn btn-success" data-open='{:url("$classuri/add")}?id={$vo.id}'>查看详情</button>
                        {else}
                        <button type="button" class="btn btn-success">Action</button>
                        {/if}
                        <button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            <span class="caret"></span>
                        </button>
                        <ul class="dropdown-menu">
                            {if auth("$classuri/forbid") && $vo.status==1}
                            <li><a data-update="{$vo.id}" data-field="status" data-value="2" data-action='{:url("$classuri/forbid")}'>禁用</a></li>
                            {/if}
                            {if auth("$classuri/resume") && $vo.status==2}
                            <li><a data-update="{$vo.id}" data-field="status" data-value="1" data-action='{:url("$classuri/resume")}'>启用</a></li>
                            {/if}
                            {if auth("$classuri/del")}
                            <li><a data-update="{$vo.id}" data-field='delete' data-action='{:url("$classuri/del")}'>删除</a></li>
                            {/if}
                        </ul>
                    </div>
                </td>
            </tr>
        {/foreach}
        </tbody>
    </table>
    {if isset($page)}<p>{$page|raw}</p>{/if}
    {/empty}
</form>
{/block}